<?php
/**
 * Implements common methods
 * 
 * @author Hồ Hữu Tài <ho.huutai@gnt.com.vn>
 * @Url
 * @Update History
 *      Date(yyyy/mm/dd)  |      Editor          |      Description
 *   2011/11/29                 Hồ Hữu Tài              create new
 */
class Common
{

    /**
     *
     * @param string $dbName Database name
     * @return CDbConnection $db return a database connection for $dbName
     */
    public static function getDbConnection($dbName)
    {
        $dataSource = "mysql:host=".Constant::DB_SERVER.";dbname=".$dbName;
        Logger::writeLog("dataSource: ".$dataSource, Logger::INFO_LEVEL, "Common::getDbConnection");
        
        $db = new CDbConnection($dataSource, Constant::DB_USER, Constant::DB_PASS);
        $db->active = true;

        return $db;
    }

   
}

?>